package j.util.jdbc;

import j.util.StringUtils;

/**
 * User: jason
 * Date: 13-9-24 上午10:05
 */
public enum DatabaseType {
    UNKNOWN{
        @Override
        public String getName() {
            return "UNKNOWN";
        }

        @Override
        public String toString() {
            return "UNKNOWN";
        }
    },
    MYSQL {
        @Override
        public String getName() {
            return "Oracle MySQL";
        }

        @Override
        public String toString() {
            return "MySQL";
        }
    },
    MSSQL{
        @Override
        public String getName() {
            return "Microsoft SQL Server";
        }

        @Override
        public String toString() {
            return "Microsoft SQL Server";
        }
    },
    ORACLE{
        @Override
        public String getName() {
            return "Oracle";
        }

        @Override
        public String toString() {
            return "Oracle";
        }
    },
    DB2{
        @Override
        public String getName() {
            return "IBM DB2";
        }

        @Override
        public String toString() {
            return "DB2";
        }
    };
    public abstract String getName();
    public static DatabaseType parseDatabaseType(String typeName){
        if(StringUtils.isNullOrEmpty(typeName)){
            return DatabaseType.UNKNOWN;
        }else if(typeName.equals("MySQL")){
            return DatabaseType.MYSQL;
        }else if(typeName.equals("Microsoft SQL Server")){
            return DatabaseType.MSSQL;
        }
        return DatabaseType.MSSQL;
    }
}
